package parse_and_index.model;

import java.io.Serializable;

public class TermFrequency implements Serializable {

	  private static final long  serialVersionUID = -1423958730783214209L;
	  private static final short MAX_VALUE		= 32767;
	  private short			  termFrequency;
	  private short			  pageFrequency;						   // za pretrage sa vise pojmova

	  public TermFrequency() {
			termFrequency = 1;
			pageFrequency = 1;
	  }

	  public short getTF() {
			return termFrequency;
	  }

	  /* increment the tf as long as we have room for an increment */
	  public void incrementTermFrequency() {
			if (termFrequency <= MAX_VALUE) {
				  termFrequency = (short) (termFrequency + 1);
			}
	  }

	  public short getTermFrequency() {
			return termFrequency;
	  }

	  public void setTermFrequency(final short termFrequency) {
			this.termFrequency = termFrequency;
	  }

	  public short getPageFrequency() {
			return pageFrequency;
	  }

	  public void setPageFrequency(final short pageFrequency) {
			this.pageFrequency = pageFrequency;
	  }

	  @Override
	  public String toString() {
			return Integer.toString(termFrequency);
	  }
}